home *** CD-ROM | disk | FTP | other *** search
/ MacHack 1999 / MacHack 1999.toast / The Hacks / P1 Preview / Src / Starter.c < prev    next >
Encoding:
C/C++ Source or Header  |  1999-06-26  |  31.4 KB  |  1,201 lines  |  [TEXT/CWIE]

  1. /***********************************************************************
  2.  *
  3.  Copyright © 1995 - 1998, 3Com Corporation or its subsidiaries ("3Com").  
  4.  All rights reserved.
  5.    
  6.  This software may be copied and used solely for developing products for 
  7.  the Palm Computing platform and for archival and backup purposes.  Except 
  8.  for the foregoing, no part of this software may be reproduced or transmitted 
  9.  in any form or by any means or used to make any derivative work (such as 
  10.  translation, transformation or adaptation) without express written consent 
  11.  from 3Com.
  12.  
  13.  3Com reserves the right to revise this software and to make changes in content 
  14.  from time to time without obligation on the part of 3Com to provide notification 
  15.  of such revision or changes.  
  16.  3COM MAKES NO REPRESENTATIONS OR WARRANTIES THAT THE SOFTWARE IS FREE OF ERRORS 
  17.  OR THAT THE SOFTWARE IS SUITABLE FOR YOUR USE.  THE SOFTWARE IS PROVIDED ON AN 
  18.  "AS IS" BASIS.  3COM MAKES NO WARRANTIES, TERMS OR CONDITIONS, EXPRESS OR IMPLIED, 
  19.  EITHER IN FACT OR BY OPERATION OF LAW, STATUTORY OR OTHERWISE, INCLUDING WARRANTIES, 
  20.  TERMS, OR CONDITIONS OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND 
  21.  SATISFACTORY QUALITY.
  22.  
  23.  TO THE FULL EXTENT ALLOWED BY LAW, 3COM ALSO EXCLUDES FOR ITSELF AND ITS SUPPLIERS 
  24.  ANY LIABILITY, WHETHER BASED IN CONTRACT OR TORT (INCLUDING NEGLIGENCE), FOR 
  25.  DIRECT, INCIDENTAL, CONSEQUENTIAL, INDIRECT, SPECIAL, OR PUNITIVE DAMAGES OF 
  26.  ANY KIND, OR FOR LOSS OF REVENUE OR PROFITS, LOSS OF BUSINESS, LOSS OF INFORMATION 
  27.  OR DATA, OR OTHER FINANCIAL LOSS ARISING OUT OF OR IN CONNECTION WITH THIS SOFTWARE, 
  28.  EVEN IF 3COM HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
  29.  
  30.  3Com, HotSync, Palm Computing, and Graffiti are registered trademarks, and 
  31.  Palm III and Palm OS are trademarks of 3Com Corporation or its subsidiaries.
  32.  
  33.  IF THIS SOFTWARE IS PROVIDED ON A COMPACT DISK, THE OTHER SOFTWARE AND 
  34.  DOCUMENTATION ON THE COMPACT DISK ARE SUBJECT TO THE LICENSE AGREEMENT 
  35.  ACCOMPANYING THE COMPACT DISK.
  36.  
  37.  *************************************************************************
  38.  *
  39.  * PROJECT:  Pilot
  40.  * FILE:     Starter.c
  41.  * AUTHOR:   Roger Flores: May 20, 1997
  42.  *
  43.  * DECLARER: Starter
  44.  *
  45.  * DESCRIPTION:
  46.  *      
  47.  *
  48.  **********************************************************************/
  49. #include <Pilot.h>
  50. #include <SysEvtMgr.h>
  51. #include "StarterRsc.h"
  52.  
  53.  
  54.  
  55. /***********************************************************************
  56.  *
  57.  *   Entry Points
  58.  *
  59.  ***********************************************************************/
  60.  
  61.  
  62. /***********************************************************************
  63.  *
  64.  *   Internal Structures
  65.  *
  66.  ***********************************************************************/
  67. typedef struct 
  68.     {
  69.     Byte replaceme;
  70.     } StarterPreferenceType;
  71.  
  72. typedef struct 
  73.     {
  74.     Byte replaceme;
  75.     } StarterAppInfoType;
  76.  
  77. typedef StarterAppInfoType* StarterAppInfoPtr;
  78.  
  79.  
  80. /***********************************************************************
  81.  *
  82.  *   Global variables
  83.  *
  84.  ***********************************************************************/
  85. //static Boolean HideSecretRecords;
  86.  
  87.  
  88. /***********************************************************************
  89.  *
  90.  *   Internal Constants
  91.  *
  92.  ***********************************************************************/
  93. #define appFileCreator                    'strt'
  94. #define appVersionNum              0x01
  95. #define appPrefID                  0x00
  96. #define appPrefVersionNum          0x01
  97.  
  98.  
  99. // Define the minimum OS version we support
  100. #define ourMinVersion    sysMakeROMVersion(2,0,0,sysROMStageRelease,0)
  101.  
  102.  
  103. #define fauxLaunch    -1
  104.  
  105.  
  106. FormPtr prevForm;
  107.  
  108. RectanglePtr gDrawRect;
  109. Boolean gAbout, gShade, gMain;
  110.  
  111.  
  112. /***********************************************************************
  113.  *
  114.  *   Internal Functions
  115.  *
  116.  ***********************************************************************/
  117.  
  118.  
  119. /***********************************************************************
  120.  *
  121.  * FUNCTION:    RomVersionCompatible
  122.  *
  123.  * DESCRIPTION: This routine checks that a ROM version is meet your
  124.  *              minimum requirement.
  125.  *
  126.  * PARAMETERS:  requiredVersion - minimum rom version required
  127.  *                                (see sysFtrNumROMVersion in SystemMgr.h 
  128.  *                                for format)
  129.  *              launchFlags     - flags that indicate if the application 
  130.  *                                UI is initialized.
  131.  *
  132.  * RETURNED:    error code or zero if rom is compatible
  133.  *
  134.  * REVISION HISTORY:
  135.  *
  136.  ***********************************************************************/
  137. static Err RomVersionCompatible(DWord requiredVersion, Word launchFlags)
  138. {
  139.     DWord romVersion;
  140.  
  141.     // See if we're on in minimum required version of the ROM or later.
  142.     FtrGet(sysFtrCreator, sysFtrNumROMVersion, &romVersion);
  143.     if (romVersion < requiredVersion)
  144.         {
  145.         if ((launchFlags & (sysAppLaunchFlagNewGlobals | sysAppLaunchFlagUIApp)) ==
  146.             (sysAppLaunchFlagNewGlobals | sysAppLaunchFlagUIApp))
  147.             {
  148.             FrmAlert (RomIncompatibleAlert);
  149.         
  150.             // Pilot 1.0 will continuously relaunch this app unless we switch to 
  151.             // another safe one.
  152.             if (romVersion < sysMakeROMVersion(2,0,0,sysROMStageRelease,0))
  153.                 AppLaunchWithCommand(sysFileCDefaultApp, sysAppLaunchCmdNormalLaunch, NULL);
  154.             }
  155.         
  156.         return (sysErrRomIncompatible);
  157.         }
  158.  
  159.     return (0);
  160. }
  161.  
  162.  
  163. /***********************************************************************
  164.  *
  165.  * FUNCTION:    GetObjectPtr
  166.  *
  167.  * DESCRIPTION: This routine returns a pointer to an object in the current
  168.  *              form.
  169.  *
  170.  * PARAMETERS:  formId - id of the form to display
  171.  *
  172.  * RETURNED:    VoidPtr
  173.  *
  174.  * REVISION HISTORY:
  175.  *
  176.  *
  177.  ***********************************************************************/
  178. static VoidPtr GetObjectPtr(Word objectID)
  179.     {
  180.     FormPtr frmP;
  181.  
  182.  
  183.     frmP = FrmGetActiveForm();
  184.     return (FrmGetObjectPtr(frmP, FrmGetObjectIndex(frmP, objectID)));
  185. }
  186.  
  187.  
  188. /***********************************************************************
  189.  *
  190.  * FUNCTION:    MainFormInit
  191.  *
  192.  * DESCRIPTION: This routine initializes the MainForm form.
  193.  *
  194.  * PARAMETERS:  frm - pointer to the MainForm form.
  195.  *
  196.  * RETURNED:    nothing
  197.  *
  198.  * REVISION HISTORY:
  199.  *
  200.  *
  201.  ***********************************************************************/
  202. static void MainFormInit(FormPtr frmP)
  203. {
  204. }
  205.  
  206.  
  207. static Boolean HandleAboutForm(EventPtr eventP)
  208. {
  209.     Boolean handled = false;
  210.     FormPtr frm;//, prevForm;
  211.     Word hitButton;
  212.    RectanglePtr r = MemPtrNew( sizeof( RectangleType ) );
  213.     MenuBarPtr theMenuBar;
  214.     WinHandle w;
  215.     CharPtr chars;
  216.    Word index;
  217.     WordPtr num;
  218.     Handle h;
  219.     SWord x, y, oldX, oldY;
  220.  
  221.  
  222.     switch (eventP->eType) {
  223.         case ctlSelectEvent:
  224.             if ( prevForm ) {
  225.                 frm = FrmGetActiveForm();
  226.                 FrmEraseForm( frm );
  227.                 FrmDeleteForm( frm );
  228.  
  229.                 FrmSetActiveForm( prevForm );
  230.                 theMenuBar = MenuInit( FinderMenuBar );
  231.                 MenuSetActiveMenu( theMenuBar );
  232.                 MenuDrawMenu( theMenuBar );
  233.             }
  234.  
  235.             handled = true;
  236.             break;
  237.  
  238.         case frmOpenEvent:
  239.             frm = FrmGetActiveForm();
  240.             FrmDrawForm( frm );
  241.  
  242.             FrmGetFormBounds( frm, gDrawRect );
  243.  
  244.             w = FrmGetWindowHandle( frm );
  245.             WinSetDrawWindow( w );
  246.             
  247.             r->topLeft.x = 2;
  248.             r->topLeft.y = 2;
  249.             r->extent.x = 8;
  250.             r->extent.y = 8;
  251.             WinDrawRectangle( r, 0 );
  252.  
  253.             WinDrawLine( 0, 12, 150, 12 );
  254.  
  255.             index = FrmGetObjectIndex( frm, AboutVersionStringLabel );
  256.             FrmGetObjectBounds( frm, index, r );
  257.  
  258.             chars = SysGetOSVersionString();
  259.             WinDrawChars( chars, StrLen( chars ), r->topLeft.x, r->topLeft.y );
  260.  
  261. //            hitButton = FrmDoDialog( frm );
  262.             
  263.             if ( prevForm ) {
  264.                 FrmSetActiveForm( prevForm );
  265.             }
  266.             
  267.             theMenuBar = MenuInit( FinderMenuBar );
  268.             MenuSetActiveMenu( theMenuBar );
  269.             MenuDrawMenu( theMenuBar );
  270. //            FrmDeleteForm( frm );
  271.             
  272.             if ( chars )
  273.                 MemPtrFree( chars );
  274.  
  275.             handled = true;
  276.             break;
  277.  
  278.         case penUpEvent:
  279.             break;
  280.             
  281.         case penDownEvent:
  282.             oldX = x = eventP->screenX;
  283.             oldY = y = eventP->screenY;
  284.             frm = FrmGetActiveForm();
  285.             index = FrmGetObjectIndex( frm, 1104 );
  286.             FrmGetObjectBounds( frm, index, r );
  287.  
  288.             r->topLeft.x = 2;
  289.             r->topLeft.y = 2;
  290.             r->extent.x = 8;
  291.             r->extent.y = 8;
  292.  
  293.             if ( RctPtInRectangle( x, y, r ) ) {
  294.                 break;
  295.                 
  296.                 if ( prevForm ) {
  297.                     FrmEraseForm( frm );
  298.                     FrmDeleteForm( frm );
  299.  
  300.                     FrmSetActiveForm( prevForm );
  301.                     theMenuBar = MenuInit( FinderMenuBar );
  302.                     MenuSetActiveMenu( theMenuBar );
  303.                     MenuDrawMenu( theMenuBar );
  304. //                    MenuSetActiveMenu( NULL );
  305.                 }
  306.  
  307.                 handled = true;
  308.             }
  309.             else {
  310.                 r->topLeft.x = 12;
  311.                 r->topLeft.y = 0;
  312.                 r->extent.x = 148;
  313.                 r->extent.y = 12;
  314.                 
  315.                 if ( RctPtInRectangle( x, y, r ) ) {
  316.                     w = FrmGetWindowHandle( frm );
  317.                     WinSetDrawWindow( w );
  318.                     
  319.                     handled = true;
  320.                     
  321.                     while ( handled ) {
  322.                         EvtGetPen( &x, &y, &handled );
  323. /*                    
  324.                         if ( x == oldX )
  325.                             r->topLeft.x;
  326.                         else if ( x < oldX )
  327.                             r->topLeft.x = oldX - ( oldX - x );
  328.                         else if ( x > oldX )
  329.                             r->topLeft.x = oldX + ( x - oldX );
  330.                         
  331.                         if ( y == oldY )
  332.                             r->topLeft.y;
  333.                         else if ( y < oldY )
  334.                             r->topLeft.y = oldY - ( oldY - y );
  335.                         else if ( y > oldY )
  336.                             r->topLeft.y = oldY + ( y - oldY );
  337.  
  338.                         r->extent.x = 150;
  339.                         r->extent.y = 50;
  340.                         
  341.                         WinFillRectangle( r, 0 );                    
  342.                         WinDrawRectangleFrame( roundFrame, r );
  343. */
  344.                     }
  345.  
  346.                     if ( x == oldX && y == oldY )
  347.                         break;
  348.                         
  349.                     FrmGetFormBounds( frm, r );
  350.                     
  351.                     FrmEraseForm( frm );
  352.                     WinFillRectangle( r, 0 );                    
  353.                     
  354. //                    x = oldX + ( x - oldX );
  355.                     
  356.                     
  357.                     if ( x == oldX )
  358.                         r->topLeft.x;
  359.                     else if ( x < oldX )
  360.                         r->topLeft.x = oldX - ( oldX - x );
  361.                     else if ( x > oldX )
  362.                         r->topLeft.x = oldX + ( x - oldX );
  363.                     
  364.                     if ( y == oldY )
  365.                         r->topLeft.y;
  366.                     else if ( y < oldY )
  367.                         r->topLeft.y = oldY - ( oldY - y );
  368.                     else if ( y > oldY )
  369.                         r->topLeft.y = oldY + ( y - oldY );
  370.                     
  371. //                    r->topLeft.x = ( oldX <= x ) ? oldX + ( x - oldX ) : oldX - ( oldX - x );
  372. //                    r->topLeft.y = oldY + ( y - oldY );
  373. //                    r->extent.x = r->extent.x;
  374. //                    r->extent.y = r->extent.y;
  375.                 
  376. //                    WinFillRectangle( r, 0 );                    
  377. //                    WinDrawRectangleFrame( roundFrame, r );
  378. //                    FrmDrawForm( frm );
  379.  
  380.                     r->topLeft.x = x + 2;
  381.                     r->topLeft.y = y + 2;
  382.                     r->extent.x = 8;
  383.                     r->extent.y = 8;
  384. /*                    
  385.                     WinDrawRectangleFrame( rectangleFrame, r );
  386.         //            WinDrawRectangle( r, 0 );
  387.  
  388.                     WinDrawLine( x, y + 12, x + 150, y + 12 );
  389.  
  390.                     WinDrawLine( x + 13, y + 2, x + 32, y + 2 );
  391.                     WinDrawLine( x + 13, y + 4, x + 32, y + 4 );
  392.                     WinDrawLine( x + 13, y + 6, x + 32, y + 6 );
  393.                     WinDrawLine( x + 13, y + 8, x + 32, y + 8 );
  394.  
  395.                     WinDrawLine( x + 123, y + 2, x + 147, y + 2 );
  396.                     WinDrawLine( x + 123, y + 4, x + 147, y + 4 );
  397.                     WinDrawLine( x + 123, y + 6, x + 147, y + 6 );
  398.                     WinDrawLine( x + 123, y + 8, x + 147, y + 8 );
  399. */
  400.                     index = FrmGetObjectIndex( frm, AboutVersionStringLabel );
  401.                     FrmGetObjectBounds( frm, index, r );
  402.  
  403.                     chars = SysGetOSVersionString();
  404.                     WinDrawChars( chars, StrLen( chars ), x + r->topLeft.x, x + r->topLeft.y );
  405.  
  406.         //            hitButton = FrmDoDialog( frm );
  407.  
  408.                     if ( prevForm ) {
  409.         //                FrmSetActiveForm( prevForm );
  410.         //                theMenuBar = MenuGetActiveMenu();
  411.         //                theMenuBar = MenuInit( FinderMenuBar );
  412.         //                MenuSetActiveMenu( NULL );
  413.         //                MenuDrawMenu( theMenuBar );
  414.                     }
  415.             
  416.         //            FrmDeleteForm( frm );
  417.                     
  418.                     if ( chars )
  419.                         MemPtrFree( chars );
  420.  
  421.                         }
  422.                     
  423.                         handled = true;
  424.                     }
  425.                 
  426.             break;
  427.         default:
  428.             break;
  429.         
  430.         }
  431.     
  432.     return handled;
  433. }
  434.  
  435.  
  436. /***********************************************************************
  437.  *
  438.  * FUNCTION:    MainFormDoCommand
  439.  *
  440.  * DESCRIPTION: This routine performs the menu command specified.
  441.  *
  442.  * PARAMETERS:  command  - menu item id
  443.  *
  444.  * RETURNED:    nothing
  445.  *
  446.  * REVISION HISTORY:
  447.  *
  448.  *
  449.  ***********************************************************************/
  450. static Boolean MainFormDoCommand(Word command)
  451. {
  452.     Boolean handled = false;
  453. //    FormPtr prevForm;
  454.     FormPtr frm;
  455.     Word hitButton;
  456.    RectanglePtr r = MemPtrNew( sizeof( RectangleType ) );
  457.     MenuBarPtr theMenuBar;
  458.     WinHandle w;
  459.     CharPtr chars;
  460.    Word index;
  461.     WordPtr num;
  462.     Handle h;
  463.     
  464.     switch (command) {
  465.         case AppleAboutThisComputer:
  466.             prevForm = FrmGetActiveForm();
  467. /*
  468.             frm = FrmInitForm( AboutForm );
  469.             
  470.             FrmSetActiveForm( frm );
  471.             FrmSetEventHandler( frm, HandleAboutForm );
  472.  
  473.             FrmDrawForm ( frm );
  474.             w = FrmGetWindowHandle( frm );
  475. */
  476.             w = FrmGetWindowHandle( prevForm );
  477.             WinSetDrawWindow( w );
  478.  
  479.             // Main window.
  480.             r->topLeft.x = 5;
  481.             r->topLeft.y = 40;
  482.             r->extent.x = 150;
  483.             r->extent.y = 50;
  484.             
  485.             WinDrawRectangleFrame( rectangleFrame, r );
  486.  
  487.             // Close box.
  488.             r->topLeft.x += 3;
  489.             r->topLeft.y += 3;
  490.             r->extent.x = 6;
  491.             r->extent.y = 6;
  492.             
  493.             WinDrawRectangleFrame( rectangleFrame, r );
  494.  
  495.             // Window shade.
  496.             r->topLeft.x += 137;
  497.             r->topLeft.y;
  498.             r->extent.x = 6;
  499.             r->extent.y = 6;
  500.             
  501.             WinDrawRectangleFrame( rectangleFrame, r );
  502.  
  503.             // Window shade filler.
  504.             WinDrawLine( r->topLeft.x, r->topLeft.y + 1, r->topLeft.x + 6, r->topLeft.y + 1 );
  505.             WinDrawLine( r->topLeft.x, r->topLeft.y + 4, r->topLeft.x + 6, r->topLeft.y + 4 );
  506.  
  507.             gDrawRect->topLeft.x = r->topLeft.x = 5;
  508.             gDrawRect->topLeft.y = r->topLeft.y = 40;
  509.             gDrawRect->extent.x = r->extent.x = 150;
  510.             gDrawRect->extent.y = r->extent.y = 50;
  511.  
  512.             WinDrawLine( r->topLeft.x, r->topLeft.y + 12, r->topLeft.x + r->extent.x, r->topLeft.y + 12 );
  513.  
  514.             WinDrawLine( r->topLeft.x + 13, r->topLeft.y + 2, r->topLeft.x + 29, r->topLeft.y + 2 );
  515.             WinDrawLine( r->topLeft.x + 13, r->topLeft.y + 4, r->topLeft.x + 29, r->topLeft.y + 4 );
  516.             WinDrawLine( r->topLeft.x + 13, r->topLeft.y + 6, r->topLeft.x + 29, r->topLeft.y + 6 );
  517.             WinDrawLine( r->topLeft.x + 13, r->topLeft.y + 8, r->topLeft.x + 29, r->topLeft.y + 8 );
  518.  
  519.             WinDrawLine( r->topLeft.x + 120, r->topLeft.y + 2, r->topLeft.x + 134, r->topLeft.y + 2 );
  520.             WinDrawLine( r->topLeft.x + 120, r->topLeft.y + 4, r->topLeft.x + 134, r->topLeft.y + 4 );
  521.             WinDrawLine( r->topLeft.x + 120, r->topLeft.y + 6, r->topLeft.x + 134, r->topLeft.y + 6 );
  522.             WinDrawLine( r->topLeft.x + 120, r->topLeft.y + 8, r->topLeft.x + 134, r->topLeft.y + 8 );
  523.  
  524.             WinDrawChars( "About This Computer", StrLen( "About This Computer" ), r->topLeft.x + 32, r->topLeft.y );
  525.             WinDrawChars( "Palm Finder 1.0", StrLen( "Palm Finder 1.0" ), r->topLeft.x + 45, r->topLeft.y + 20 );
  526.             WinDrawChars( "PalmOS", StrLen( "PalmOS" ), r->topLeft.x + 45, r->topLeft.y + 35 );
  527.             
  528.             chars = SysGetOSVersionString();
  529.             WinDrawChars( chars, StrLen( chars ), r->topLeft.x + 80, r->topLeft.y + 35 );
  530.  
  531.             if ( chars )
  532.                 MemPtrFree( chars );
  533.  
  534.             gAbout = true;
  535.  
  536.             handled = true;
  537.             break;
  538.  
  539.         default:
  540.             break;
  541.  
  542.         }
  543.         
  544.         if ( r )
  545.             MemPtrFree( r );
  546.             
  547.     return handled;
  548. }
  549.  
  550.  
  551. /***********************************************************************
  552.  *
  553.  * FUNCTION:    MainFormHandleEvent
  554.  *
  555.  * DESCRIPTION: This routine is the event handler for the 
  556.  *              "MainForm" of this application.
  557.  *
  558.  * PARAMETERS:  eventP  - a pointer to an EventType structure
  559.  *
  560.  * RETURNED:    true if the event has handle and should not be passed
  561.  *              to a higher level handler.
  562.  *
  563.  * REVISION HISTORY:
  564.  *
  565.  *
  566.  ***********************************************************************/
  567. static Boolean MainFormHandleEvent(EventPtr eventP)
  568. {
  569.     Boolean handled = false;
  570.     //    FormPtr prevForm;
  571.     FormPtr frm, tempFrm;
  572.     MenuBarPtr theMenuBar;
  573.     Word index, origIndex, tps;
  574.     RectanglePtr r = MemPtrNew( sizeof( RectangleType ) );
  575.     BitmapPtr b;
  576.     Word hitButton;
  577.     WinHandle w, saveWin;
  578.     CharPtr chars = MemPtrNew( 32 );
  579.     WordPtr num;
  580.     Handle h;
  581.     SWord x, y, oldX, oldY;
  582.     ULong    numTicks, oldTime;
  583.     
  584.     frm = FrmGetActiveForm();
  585.  
  586.     oldX = x = eventP->screenX;
  587.     oldY = y = eventP->screenY;
  588.  
  589.     switch (eventP->eType) {
  590.         case penDownEvent:
  591.             if ( gAbout ) {
  592.                 w = FrmGetWindowHandle( frm );
  593.                 WinSetDrawWindow( w );
  594.  
  595.     //            index = FrmGetObjectIndex( frm, 1104 );
  596.     //            FrmGetObjectBounds( frm, index, r );
  597.  
  598.                 // Check close.
  599.                 r->topLeft.x = gDrawRect->topLeft.x + 3;
  600.                 r->topLeft.y = gDrawRect->topLeft.y + 3;
  601.                 r->extent.x = 6;
  602.                 r->extent.y = 6;
  603.  
  604.                 if ( RctPtInRectangle( x, y, r ) ) {
  605.                     r->topLeft.x = gDrawRect->topLeft.x - 1;
  606.                     r->topLeft.y = gDrawRect->topLeft.y - 1;
  607.                     r->extent.x = gDrawRect->extent.x + 2;
  608.                     r->extent.y = gDrawRect->extent.y + 2;
  609.  
  610.                     WinFillRectangle( r, 0 );                    
  611.                     
  612.                     if ( prevForm ) {
  613.                         FrmSetActiveForm( prevForm );
  614.                         theMenuBar = MenuInit( FinderMenuBar );
  615.                         MenuSetActiveMenu( theMenuBar );
  616.                         MenuDrawMenu( theMenuBar );
  617.                     }
  618.  
  619.                     gAbout = false;
  620.                     handled = true;
  621.                     break;
  622.                 }
  623.  
  624.                 // Check shade.
  625.                 r->topLeft.x = gDrawRect->topLeft.x + gDrawRect->extent.x - 12;
  626.                 r->topLeft.y = gDrawRect->topLeft.y + 3;
  627.                 r->extent.x = 6;
  628.                 r->extent.y = 6;
  629.  
  630.                 if ( RctPtInRectangle( x, y, r ) ) {
  631.                     if ( !gShade ) {
  632.                         r->topLeft.x = gDrawRect->topLeft.x - 1;
  633.                         r->topLeft.y = gDrawRect->topLeft.y + 13;
  634.                         r->extent.x = gDrawRect->extent.x + 2;
  635.                         r->extent.y = gDrawRect->extent.y - 12;
  636.  
  637.                         WinFillRectangle( r, 0 );                    
  638.                     }
  639.                     else {
  640.                         // Main window.
  641.                         r->topLeft.x = gDrawRect->topLeft.x;
  642.                         r->topLeft.y = gDrawRect->topLeft.y;
  643.                         r->extent.x = gDrawRect->extent.x;
  644.                         r->extent.y = gDrawRect->extent.y;
  645.                         
  646.                         WinDrawRectangleFrame( rectangleFrame, r );
  647.  
  648.                         // Close box.
  649.                         r->topLeft.x += 3;
  650.                         r->topLeft.y += 3;
  651.                         r->extent.x = 6;
  652.                         r->extent.y = 6;
  653.                         
  654.                         WinDrawRectangleFrame( rectangleFrame, r );
  655.  
  656.                         // Window shade.
  657.                         r->topLeft.x += 137;
  658.                         r->topLeft.y;
  659.                         r->extent.x = 6;
  660.                         r->extent.y = 6;
  661.                         
  662.                         WinDrawRectangleFrame( rectangleFrame, r );
  663.  
  664.                         // Window shade filler.
  665.                         WinDrawLine( r->topLeft.x, r->topLeft.y + 1, r->topLeft.x + 6, r->topLeft.y + 1 );
  666.                         WinDrawLine( r->topLeft.x, r->topLeft.y + 4, r->topLeft.x + 6, r->topLeft.y + 4 );
  667.  
  668.                         r->topLeft.x = gDrawRect->topLeft.x;
  669.                         r->topLeft.y = gDrawRect->topLeft.y;
  670.                         r->extent.x = gDrawRect->extent.x;
  671.                         r->extent.y = gDrawRect->extent.y;
  672.                         
  673.                         WinDrawLine( r->topLeft.x, r->topLeft.y + 12, r->topLeft.x + r->extent.x, r->topLeft.y + 12 );
  674.  
  675.                         WinDrawLine( r->topLeft.x + 13, r->topLeft.y + 2, r->topLeft.x + 29, r->topLeft.y + 2 );
  676.                         WinDrawLine( r->topLeft.x + 13, r->topLeft.y + 4, r->topLeft.x + 29, r->topLeft.y + 4 );
  677.                         WinDrawLine( r->topLeft.x + 13, r->topLeft.y + 6, r->topLeft.x + 29, r->topLeft.y + 6 );
  678.                         WinDrawLine( r->topLeft.x + 13, r->topLeft.y + 8, r->topLeft.x + 29, r->topLeft.y + 8 );
  679.  
  680.                         WinDrawLine( r->topLeft.x + 120, r->topLeft.y + 2, r->topLeft.x + 134, r->topLeft.y + 2 );
  681.                         WinDrawLine( r->topLeft.x + 120, r->topLeft.y + 4, r->topLeft.x + 134, r->topLeft.y + 4 );
  682.                         WinDrawLine( r->topLeft.x + 120, r->topLeft.y + 6, r->topLeft.x + 134, r->topLeft.y + 6 );
  683.                         WinDrawLine( r->topLeft.x + 120, r->topLeft.y + 8, r->topLeft.x + 134, r->topLeft.y + 8 );
  684.  
  685.                         WinDrawChars( "About This Computer", StrLen( "About This Computer" ), r->topLeft.x + 32, r->topLeft.y );
  686.                         WinDrawChars( "Palm Finder 1.0", StrLen( "Palm Finder 1.0" ), r->topLeft.x + 45, r->topLeft.y + 20 );
  687.                         WinDrawChars( "PalmOS", StrLen( "PalmOS" ), r->topLeft.x + 45, r->topLeft.y + 35 );
  688.                         
  689.                         chars = SysGetOSVersionString();
  690.                         WinDrawChars( chars, StrLen( chars ), r->topLeft.x + 80, r->topLeft.y + 35 );
  691.  
  692.                         if ( chars )
  693.                             MemPtrFree( chars );
  694.                     }
  695.                     
  696.                     gShade = !gShade;
  697.  
  698.                     handled = true;
  699.                     break;
  700.                 }
  701.  
  702.                 // Check drag.
  703.                 r->topLeft.x = gDrawRect->topLeft.x + 12;
  704.                 r->topLeft.y = gDrawRect->topLeft.y;
  705.                 r->extent.x = gDrawRect->extent.x - 24;
  706.                 r->extent.y = 12;
  707.  
  708.                 if ( RctPtInRectangle( x, y, r ) ) {
  709.                     w = FrmGetWindowHandle( frm );
  710.                     WinSetDrawWindow( w );
  711.                     
  712.                     handled = true;
  713.                     
  714.                     while ( handled ) {
  715.                         EvtGetPen( &x, &y, &handled );
  716.  
  717. //                        saveWin = WinSaveBits( gDrawRect, num );
  718.                         
  719.                         r->topLeft.x = gDrawRect->topLeft.x - 1;
  720.                         r->topLeft.y = gDrawRect->topLeft.y - 1;
  721.                         r->extent.x = gDrawRect->extent.x + 2;
  722.                         r->extent.y = gDrawRect->extent.y + 2;
  723.  
  724.                         WinFillRectangle( r, 0 );                    
  725.         
  726.                         if ( x == oldX )
  727.                             gDrawRect->topLeft.x;
  728.                         else if ( x < oldX )
  729.                             gDrawRect->topLeft.x = oldX - ( oldX - x );
  730.                         else if ( x > oldX )
  731.                             gDrawRect->topLeft.x = oldX + ( x - oldX );
  732.                         
  733.                         if ( y == oldY )
  734.                             gDrawRect->topLeft.y;
  735.                         else if ( y < oldY )
  736.                             gDrawRect->topLeft.y = oldY - ( oldY - y );
  737.                         else if ( y > oldY )
  738.                             gDrawRect->topLeft.y = oldY + ( y - oldY );
  739.                         
  740. //                        WinDrawRectangleFrame( rectangleFrame, gDrawRect );                    
  741.  
  742.                         // Main window.
  743.                         r->topLeft.x = gDrawRect->topLeft.x;
  744.                         r->topLeft.y = gDrawRect->topLeft.y;
  745.                         r->extent.x = gDrawRect->extent.x;
  746.                         r->extent.y = gDrawRect->extent.y;
  747.  
  748.                         if ( gShade ) {
  749.                             r->extent.y = 12;
  750.                         }
  751.                         
  752.                         WinDrawRectangleFrame( rectangleFrame, r );
  753.  
  754.                         // Close box.
  755.                         r->topLeft.x += 3;
  756.                         r->topLeft.y += 3;
  757.                         r->extent.x = 6;
  758.                         r->extent.y = 6;
  759.                         
  760.                         WinDrawRectangleFrame( rectangleFrame, r );
  761.  
  762.                         // Window shade.
  763.                         r->topLeft.x += 137;
  764.                         r->topLeft.y;
  765.                         r->extent.x = 6;
  766.                         r->extent.y = 6;
  767.                         
  768.                         WinDrawRectangleFrame( rectangleFrame, r );
  769.  
  770.                         // Window shade filler.
  771.                         WinDrawLine( r->topLeft.x, r->topLeft.y + 1, r->topLeft.x + 6, r->topLeft.y + 1 );
  772.                         WinDrawLine( r->topLeft.x, r->topLeft.y + 4, r->topLeft.x + 6, r->topLeft.y + 4 );
  773.  
  774.                         r->topLeft.x = gDrawRect->topLeft.x;
  775.                         r->topLeft.y = gDrawRect->topLeft.y;
  776.                         r->extent.x = gDrawRect->extent.x;
  777.                         r->extent.y = gDrawRect->extent.y;
  778.                         
  779.                         WinDrawLine( r->topLeft.x, r->topLeft.y + 12, r->topLeft.x + r->extent.x, r->topLeft.y + 12 );
  780.  
  781.                         WinDrawLine( r->topLeft.x + 13, r->topLeft.y + 2, r->topLeft.x + 29, r->topLeft.y + 2 );
  782.                         WinDrawLine( r->topLeft.x + 13, r->topLeft.y + 4, r->topLeft.x + 29, r->topLeft.y + 4 );
  783.                         WinDrawLine( r->topLeft.x + 13, r->topLeft.y + 6, r->topLeft.x + 29, r->topLeft.y + 6 );
  784.                         WinDrawLine( r->topLeft.x + 13, r->topLeft.y + 8, r->topLeft.x + 29, r->topLeft.y + 8 );
  785.  
  786.                         WinDrawLine( r->topLeft.x + 120, r->topLeft.y + 2, r->topLeft.x + 134, r->topLeft.y + 2 );
  787.                         WinDrawLine( r->topLeft.x + 120, r->topLeft.y + 4, r->topLeft.x + 134, r->topLeft.y + 4 );
  788.                         WinDrawLine( r->topLeft.x + 120, r->topLeft.y + 6, r->topLeft.x + 134, r->topLeft.y + 6 );
  789.                         WinDrawLine( r->topLeft.x + 120, r->topLeft.y + 8, r->topLeft.x + 134, r->topLeft.y + 8 );
  790.  
  791.                         if ( !gShade ) {
  792.                             WinDrawChars( "About This Computer", StrLen( "About This Computer" ), r->topLeft.x + 32, r->topLeft.y );
  793.                             WinDrawChars( "Palm Finder 1.0", StrLen( "Palm Finder 1.0" ), r->topLeft.x + 45, r->topLeft.y + 20 );
  794.                             WinDrawChars( "PalmOS", StrLen( "PalmOS" ), r->topLeft.x + 45, r->topLeft.y + 35 );
  795.                             
  796.                             chars = SysGetOSVersionString();
  797.                             WinDrawChars( chars, StrLen( chars ), r->topLeft.x + 80, r->topLeft.y + 35 );
  798.                         
  799.                             if ( chars )
  800.                                 MemPtrFree( chars );
  801.                         }
  802.  
  803. //                        WinRestoreBits( saveWin, x, y );
  804.                     }
  805.  
  806.                     handled = true;
  807.                     break;
  808.                 }
  809.             }
  810.  
  811.             // Check drive icon.
  812. //            x = eventP->screenX;
  813. //            y = eventP->screenY;
  814. //            frm = FrmGetActiveForm();
  815.             
  816.             index = FrmGetObjectIndex( frm, MainDriveBitMap );
  817.             origIndex = index;
  818.             FrmGetObjectBounds( frm, index, r );
  819.  
  820.             if ( RctPtInRectangle( x, y, r ) ) {
  821.                 w = FrmGetWindowHandle( frm );
  822.                 WinSetDrawWindow( w );
  823.                 
  824. //                index = FrmGetObjectIndex( frm, MainDriveMaskBitMap );
  825.                 h = MemHandleNew( 255 );
  826.                 h = DmGet1Resource( 'PICT', DriveMaskBitmap );
  827.                 b = ( BitmapPtr )MemHandleLock( h );
  828. //                b = ( BitmapPtr )DmGetResource( 'PICT', DriveMaskBitmap );
  829.                 WinDrawBitmap( b, r->topLeft.x,  r->topLeft.y );
  830.                 DmReleaseResource( h );
  831.                 MemHandleUnlock( h );
  832.                 MemHandleFree( h );
  833.  
  834.                 r->topLeft.x -= 1;
  835.                 r->extent.x = 0;
  836.                 r->extent.y = 0;
  837.  
  838.                 tps = SysTicksPerSecond();
  839.                 
  840.                 index = 0;
  841.                 
  842.                 oldTime = TimGetTicks();
  843.                 
  844.                 while ( index < 4 ) {
  845.                     numTicks = TimGetTicks();
  846.                 
  847.                     if ( numTicks >= ( oldTime + ( tps / 4 ) ) ) {
  848.                         if ( index > 0 ) {
  849.                             r->topLeft.x -= 1;
  850.                             r->topLeft.y -= 1;
  851.                             r->extent.x += 2;
  852.                             r->extent.y += 2;
  853.  
  854.                             WinFillRectangle( r, 0 );
  855.                             
  856.                             r->topLeft.x += 1;
  857.                             r->topLeft.y += 1;
  858.                             r->extent.x -= 2;
  859.                             r->extent.y -= 2;
  860.                         }
  861.                         
  862.                         r->topLeft.x -= 25;
  863.                         r->topLeft.y += 5;
  864.                         r->extent.x += 25;
  865.                         r->extent.y += 20;
  866.  
  867.                         WinDrawRectangleFrame( rectangleFrame, r );
  868.  
  869.                         oldTime = numTicks;
  870.                         index++;
  871.                     }
  872.                 }
  873.  
  874.                 gMain = true;
  875.             }
  876.  
  877.             break;
  878.  
  879.         case menuEvent:
  880.             frm = FrmGetActiveForm();
  881.  
  882.             if ( FrmGetFormPtr( AboutForm ) != frm )
  883.                 handled = MainFormDoCommand(eventP->data.menu.itemID);
  884.     
  885.             break;
  886.             
  887.         case frmOpenEvent:
  888.             frm = FrmGetActiveForm();
  889.             MainFormInit( frm );
  890.             FrmDrawForm ( frm );
  891. /*                
  892.             w = FrmGetWindowHandle( frm );
  893.             WinSetDrawWindow( w );
  894.             index = FrmGetObjectIndex( frm, MainDriveMaskBitMap );
  895.             b = ( BitmapPtr )FrmGetObjectPtr( frm, index );
  896.             WinDrawBitmap( b, 200,  200 );
  897. */
  898.             theMenuBar = MenuInit( FinderMenuBar );
  899.             MenuSetActiveMenu( theMenuBar );
  900.             MenuDrawMenu( theMenuBar );
  901.  
  902.             handled = true;
  903.             break;
  904.  
  905.         default:
  906.             break;
  907.         
  908.         }
  909.         
  910.         if ( r )
  911.             MemPtrFree( r );
  912.     
  913.     return handled;
  914. }
  915.  
  916.  
  917. /***********************************************************************
  918.  *
  919.  * FUNCTION:    AppHandleEvent
  920.  *
  921.  * DESCRIPTION: This routine loads form resources and set the event
  922.  *              handler for the form loaded.
  923.  *
  924.  * PARAMETERS:  event  - a pointer to an EventType structure
  925.  *
  926.  * RETURNED:    true if the event has handle and should not be passed
  927.  *              to a higher level handler.
  928.  *
  929.  * REVISION HISTORY:
  930.  *
  931.  *
  932.  ***********************************************************************/
  933. static Boolean AppHandleEvent( EventPtr eventP)
  934. {
  935.     Word formId, index;
  936.     FormPtr frmP;
  937.  
  938.     if (eventP->eType == frmLoadEvent)
  939.         {
  940.         // Load the form resource.
  941.         formId = eventP->data.frmLoad.formID;
  942.         frmP = FrmInitForm(formId);
  943.         FrmSetActiveForm(frmP);
  944.  
  945. //        index = FrmGetObjectIndex( frmP, MainDriveMaskBitMap );
  946. //        FrmHideObject( frmP, index );
  947.  
  948.         // Set the event handler for the form.  The handler of the currently
  949.         // active form is called by FrmHandleEvent each time is receives an
  950.         // event.
  951.         switch (formId)
  952.             {
  953.             case MainForm:
  954.                 FrmSetEventHandler(frmP, MainFormHandleEvent);
  955.                 break;
  956.  
  957.             case AboutForm:
  958.                 FrmSetEventHandler( frmP, HandleAboutForm );
  959.  
  960.             default:
  961.                 ErrFatalDisplay("Invalid Form Load Event");
  962.                 break;
  963.  
  964.             }
  965.         return true;
  966.         }
  967.     
  968.     return false;
  969. }
  970.  
  971.  
  972. /***********************************************************************
  973.  *
  974.  * FUNCTION:    AppEventLoop
  975.  *
  976.  * DESCRIPTION: This routine is the event loop for the application.  
  977.  *
  978.  * PARAMETERS:  nothing
  979.  *
  980.  * RETURNED:    nothing
  981.  *
  982.  * REVISION HISTORY:
  983.  *
  984.  *
  985.  ***********************************************************************/
  986. static void AppEventLoop(void)
  987. {
  988.     Word error;
  989.     EventType event;
  990.  
  991.  
  992.     do {
  993.         EvtGetEvent(&event, evtWaitForever);
  994.         
  995.         
  996.         if (! SysHandleEvent(&event))
  997.             if (! MenuHandleEvent(0, &event, &error))
  998.                 if (! AppHandleEvent(&event))
  999.                     FrmDispatchEvent(&event);
  1000.  
  1001.     } while (event.eType != appStopEvent);
  1002. }
  1003.  
  1004.  
  1005. /***********************************************************************
  1006.  *
  1007.  * FUNCTION:     AppStart
  1008.  *
  1009.  * DESCRIPTION:  Get the current application's preferences.
  1010.  *
  1011.  * PARAMETERS:   nothing
  1012.  *
  1013.  * RETURNED:     Err value 0 if nothing went wrong
  1014.  *
  1015.  * REVISION HISTORY:
  1016.  *
  1017.  *
  1018.  ***********************************************************************/
  1019. static Err AppStart(void)
  1020. {
  1021.     StarterPreferenceType prefs;
  1022.     Word prefsSize;
  1023.  
  1024.  
  1025.     // Read the saved preferences / saved-state information.
  1026.     prefsSize = sizeof(StarterPreferenceType);
  1027.     if (PrefGetAppPreferences(appFileCreator, appPrefID, &prefs, &prefsSize, true) != 
  1028.         noPreferenceFound)
  1029.         {
  1030.         }
  1031.     
  1032.    return 0;
  1033. }
  1034.  
  1035.  
  1036. /***********************************************************************
  1037.  *
  1038.  * FUNCTION:    AppStop
  1039.  *
  1040.  * DESCRIPTION: Save the current state of the application.
  1041.  *
  1042.  * PARAMETERS:  nothing
  1043.  *
  1044.  * RETURNED:    nothing
  1045.  *
  1046.  * REVISION HISTORY:
  1047.  *
  1048.  *
  1049.  ***********************************************************************/
  1050. static void AppStop(void)
  1051. {
  1052.    StarterPreferenceType prefs;
  1053.    
  1054.    
  1055.     // Write the saved preferences / saved-state information.  This data 
  1056.     // will be backed up during a HotSync.
  1057.     PrefSetAppPreferences (appFileCreator, appPrefID, appPrefVersionNum, 
  1058.         &prefs, sizeof (prefs), true);
  1059. }
  1060.  
  1061.  
  1062.  
  1063. /***********************************************************************
  1064.  *
  1065.  * FUNCTION:    StarterPilotMain
  1066.  *
  1067.  * DESCRIPTION: This is the main entry point for the application.
  1068.  * PARAMETERS:  cmd - word value specifying the launch code. 
  1069.  *              cmdPB - pointer to a structure that is associated with the launch code. 
  1070.  *              launchFlags -  word value providing extra information about the launch.
  1071.  *
  1072.  * RETURNED:    Result of launch
  1073.  *
  1074.  * REVISION HISTORY:
  1075.  *
  1076.  *
  1077.  ***********************************************************************/
  1078. static DWord StarterPilotMain(Word cmd, Ptr cmdPBP, Word launchFlags)
  1079. {
  1080.     Err error;
  1081.  
  1082.  
  1083.     error = RomVersionCompatible (ourMinVersion, launchFlags);
  1084.     if (error) return (error);
  1085.  
  1086.  
  1087.     switch (cmd)
  1088.         {
  1089.         case sysAppLaunchCmdNormalLaunch:
  1090.             error = AppStart();
  1091.             if (error) 
  1092.                 return error;
  1093.                 
  1094.             gDrawRect = MemPtrNew( sizeof( RectangleType ) );
  1095.             gMain = gShade = gAbout = false;
  1096.             
  1097.             FrmGotoForm(MainForm);
  1098.             AppEventLoop();
  1099.             AppStop();
  1100.             break;
  1101.  
  1102.         default:
  1103.             break;
  1104.  
  1105.         }
  1106.     
  1107.     return 0;
  1108. }
  1109.  
  1110.  
  1111. /***********************************************************************
  1112.  *
  1113.  * FUNCTION:    PilotMain
  1114.  *
  1115.  * DESCRIPTION: This is the main entry point for the application.
  1116.  *
  1117.  * PARAMETERS:  cmd - word value specifying the launch code. 
  1118.  *              cmdPB - pointer to a structure that is associated with the launch code. 
  1119.  *              launchFlags -  word value providing extra information about the launch.
  1120.  * RETURNED:    Result of launch
  1121.  *
  1122.  * REVISION HISTORY:
  1123.  *
  1124.  *
  1125.  ***********************************************************************/
  1126. DWord PilotMain( Word cmd, Ptr cmdPBP, Word launchFlags)
  1127. {
  1128.     return StarterPilotMain(cmd, cmdPBP, launchFlags);
  1129. }
  1130.  
  1131. /*            
  1132.             x = eventP->screenX;
  1133.             y = eventP->screenY;
  1134.             frm = FrmGetActiveForm();
  1135.             index = FrmGetObjectIndex( frm, MainDriveBitMap );
  1136.             origIndex = index;
  1137.             FrmGetObjectBounds( frm, index, r );
  1138.  
  1139.             if ( RctPtInRectangle( x, y, r ) ) {
  1140.  
  1141.                 frm = FrmGetActiveForm();
  1142.                 index = FrmGetObjectIndex( frm, MainDriveBitMap );
  1143.                 FrmHideObject( frm, index );
  1144.                 FrmSetObjectPosition( frm, index, 200, 200 );
  1145.             
  1146. //                index = FrmGetObjectIndex( frm, MainDriveMaskBitMap );
  1147. //                b = ( BitmapPtr )FrmGetObjectPtr( frm, index );
  1148. //                WinDrawBitmap( b, x, y );
  1149.                 index = FrmGetObjectIndex( frm, MainDriveMaskBitMap );
  1150.                 FrmShowObject( frm, index );
  1151.                 FrmSetObjectBounds( frm, index, r );
  1152.                 
  1153. //                FrmNewBitmap( &frm, DriveMaskBitmap, DriveMaskBitmap, x, y );
  1154.  
  1155.                 MainFormDoCommand( fauxLaunch );
  1156.  
  1157. //                frm = FrmGetActiveForm();
  1158.                 FrmHideObject( frm, index );
  1159.                 FrmSetObjectPosition( frm, index, 200, 200 );
  1160. //                WinInvertRectangle( r, 0 );
  1161.                 
  1162.                 index = FrmGetObjectIndex( frm, MainDriveBitMap );
  1163. //                b = ( BitmapPtr )FrmGetObjectPtr( frm, index );
  1164. //                WinDrawBitmap( b, x, y );
  1165.                 FrmShowObject( frm, index );
  1166.                 FrmSetObjectPosition( frm, index, 135, 15 );
  1167. //                FrmNewBitmap( &frm, DriveBitmap, DriveBitmap, x, y );
  1168.                 handled = true;
  1169.             }
  1170. */            
  1171. /*
  1172.         case fauxLaunch:
  1173.             prevForm = FrmGetActiveForm();
  1174.             frm = FrmInitForm( NewWindowForm );
  1175.             
  1176.             FrmSetActiveForm( frm );
  1177.             
  1178.             r->topLeft.x = 2;
  1179.             r->topLeft.y = 2;
  1180.             r->extent.x = 8;
  1181.             r->extent.y = 8;
  1182.             WinDrawRectangle( r, 0 );
  1183.             
  1184.             h = MemHandleNew( 32 );
  1185.             SysCreateDataBaseList( 0, 0, num, &h,true);
  1186.             
  1187.             hitButton = FrmDoDialog( frm );
  1188.             
  1189.             if ( prevForm ) {
  1190.                 FrmSetActiveForm( prevForm );
  1191.                 theMenuBar = MenuInit( FinderMenuBar );
  1192.                 MenuSetActiveMenu( theMenuBar );
  1193.                 MenuDrawMenu( theMenuBar );
  1194.             }
  1195.             
  1196.             FrmDeleteForm( frm );
  1197.  
  1198.             handled = true;
  1199.             break;
  1200. */
  1201.